<!DOCTYPE html>
<html>
<head>
	<title></title>
	<link rel="stylesheet" type="text/css" href="../bower_components/bootstrap/dist/css/bootstrap.css">
	<script type="text/javascript" src="//cdn.bootcss.com/jquery/1.12.2/jquery.js"></script>
	<meta charset="utf-8">
	<style type="text/css">
		.main{
			margin-top: 300px;
		}
	</style>
</head>
<body>
	<div class="row">
		<div class="col-xs-4 col-xs-offset-4 main">
		<div id="login_head" class="page-header">
			<h3>登陆 <a href="register" class="pull-right">注册</a></h3>
		</div>
		<div class='warning' style="display: hidden"></div>	
			<form action="dologin" method="post">
				<div class="form-group">
					<label for="exampleInputEmail1">用户名：</label>
					<input type="text" name="username" class="form-control" id="exampleInputEmail1" placeholder="请输入用户名">
				</div>
				<div class="form-group">
					<label for="exampleInputEmail1">密码：</label>
					<input type="password" name="password" class="form-control" id="exampleInputEmail1" placeholder="请输入密码">
				</div>
				<div class="row">
					<div class="col-xs-2 col-xs-offset-5">
						<button id="submit" class="btn" type="submit">提交</button>
					</div>
				</div>
				
			</form>
		</div>
	</div>
	
</body>
</html>


<script type="text/javascript">
	$(function(){
		$('#submit').click(function(){
			$.post("dologin",
				{
					username:$('input[name="username"]').val(),
					password:$('input[name="password"]').val()
				}	
			,function(res,status){
				if (res=="登陆成功") {
					location.href="/admin/articleLists"
				}else{
					/*alert(res)*/
					$('.warning').addClass("bg-danger")
								 .show()
								 .append(res)
								 .fadeOut(5000)
				}	
			
			})
			return false;
		})
		
	})

</script>